﻿using System;
using System.Collections.Generic;
using MiniJSON;

namespace XUtliPoolLib
{
	// Token: 0x0200009A RID: 154
	public class PDatabase : XSingleton<PDatabase>
	{
		// Token: 0x060004BF RID: 1215 RVA: 0x00015270 File Offset: 0x00013470
		public void HandleExData(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]HandleExData msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			switch (this.GetApiId(msg))
			{
			case 1:
				this.SerialPlayerInfo(msg);
				break;
			case 2:
				this.SerialFriendsInfo(msg);
				break;
			case 6:
				this.SerialGuildGroupResult(msg);
				break;
			case 7:
				this.SerialGuildGroupInfo(msg);
				break;
			case 8:
				this.SerialGuildGroupResult(msg);
				break;
			case 9:
				this.SerialShareResult(msg);
				break;
			case 12:
				this.SerialHandleReplay(msg);
				break;
			case 16:
				this.SerialQQVipPayInfo(msg);
				break;
			case 17:
				this.SerialPaySubscribeInfo(msg);
				break;
			case 18:
				this.SerialMarketingInfo(msg);
				break;
			case 19:
				this.SerialGameCenterLaunch(msg);
				break;
			case 20:
				this.SerialHandle3DTouch(msg);
				break;
			case 21:
				this.SerialHandleScreenLock(msg);
				break;
			case 22:
				this.SerialBuyGoodsInfo(msg);
				break;
			case 23:
				this.SerialPandoraSDKBuyGoodsInfo(msg);
				break;
			}
		}

		// Token: 0x060004C0 RID: 1216 RVA: 0x000153B0 File Offset: 0x000135B0
		private int GetApiId(string msg)
		{
			Dictionary<string, object> dictionary = Json.Deserialize(msg) as Dictionary<string, object>;
			int result = 1;
			int.TryParse(dictionary["apiId"].ToString(), out result);
			return result;
		}

		// Token: 0x060004C1 RID: 1217 RVA: 0x000153E9 File Offset: 0x000135E9
		public void SerialPlayerInfo(string msg)
		{
			this.playerInfo = XSingleton<PUtil>.singleton.Deserialize<PlayerInfo>(msg);
		}

		// Token: 0x060004C2 RID: 1218 RVA: 0x00015400 File Offset: 0x00013600
		public void SerialFriendsInfo(string msg)
		{
			this.friendsInfo = XSingleton<PUtil>.singleton.Deserialize<FriendInfo>(msg);
			IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
			if (@interface == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialFriendsInfo entrance == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				@interface.OnGetPlatFriendsInfo();
			}
		}

		// Token: 0x060004C3 RID: 1219 RVA: 0x00015464 File Offset: 0x00013664
		public void SerialGuildGroupResult(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialGuildGroupResult msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			WXGroupResult wxgroupResult = XSingleton<PUtil>.singleton.Deserialize<WXGroupResult>(msg);
			if (wxgroupResult == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialGuildGroupResult wxGroupResult == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
				if (@interface == null)
				{
					XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialGuildGroupResult entrance == null", null, null, null, null, null, XDebugColor.XDebug_None);
				}
				else
				{
					@interface.OnWXGroupResult(wxgroupResult.apiId.ToString(), wxgroupResult.data.flag, wxgroupResult.data.errorCode, this.wxGroupCallbackType);
				}
			}
		}

		// Token: 0x060004C4 RID: 1220 RVA: 0x00015524 File Offset: 0x00013724
		public void SerialGuildGroupInfo(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialGuildGroupInfo msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			this.wxGroupInfo = XSingleton<PUtil>.singleton.Deserialize<WXGroupInfo>(msg);
			if (this.wxGroupInfo == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialGuildGroupInfo wxGroupInfo == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
				if (@interface == null)
				{
					XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialGuildGroupInfo entrance == null", null, null, null, null, null, XDebugColor.XDebug_None);
				}
				else
				{
					@interface.RefreshWXGroupBtn(this.wxGroupCallbackType);
				}
			}
		}

		// Token: 0x060004C5 RID: 1221 RVA: 0x000155D0 File Offset: 0x000137D0
		public void SerialShareResult(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialShareResult msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			Dictionary<string, object> dictionary = Json.Deserialize(msg) as Dictionary<string, object>;
			if (dictionary == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialShareResult dict == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				object obj = null;
				if (dictionary.TryGetValue("data", out obj))
				{
					IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
					if (@interface != null)
					{
						@interface.NoticeShareResult(obj.ToString(), this.shareCallbackType);
					}
				}
				this.shareCallbackType = ShareCallBackType.Normal;
			}
		}

		// Token: 0x060004C6 RID: 1222 RVA: 0x00015680 File Offset: 0x00013880
		public void SerialQQVipPayInfo(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialQQVipPayInfo msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			Dictionary<string, object> dictionary = Json.Deserialize(msg) as Dictionary<string, object>;
			if (dictionary == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialQQVipPayInfo dict == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
				object obj;
				if (dictionary.TryGetValue("data", out obj))
				{
					Dictionary<string, object> dictionary2 = obj as Dictionary<string, object>;
					object obj2;
					if (dictionary2.TryGetValue("flag", out obj2))
					{
						if (@interface != null)
						{
							XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialQQVipPayInfo result =" + obj2.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
							@interface.OnQQVipPayCallback(obj2.ToString());
						}
					}
				}
			}
		}

		// Token: 0x060004C7 RID: 1223 RVA: 0x00015764 File Offset: 0x00013964
		private void SerialGameCenterLaunch(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialGameCenterLaunch msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			Dictionary<string, object> dictionary = Json.Deserialize(msg) as Dictionary<string, object>;
			if (dictionary == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialGameCenterLaunch dict == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
				object obj;
				if (dictionary.TryGetValue("data", out obj) && @interface != null)
				{
					Dictionary<string, object> dictionary2 = obj as Dictionary<string, object>;
					object obj2 = null;
					if (dictionary2 != null && dictionary2.TryGetValue("wakeup_platform", out obj2))
					{
						XSingleton<XDebug>.singleton.AddLog("[SerialGameCenterLaunch] platform: " + obj2.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
						if ((long)obj2 == 1L)
						{
							XSingleton<XDebug>.singleton.AddLog("[SerialGameCenterLaunch] platform == 1", null, null, null, null, null, XDebugColor.XDebug_None);
							object obj3 = null;
							if (dictionary2.TryGetValue("wakeup_wx_extInfo", out obj3))
							{
								if (obj3.ToString() == "WX_GameCenter")
								{
									@interface.OnGameCenterWakeUp(3);
									XSingleton<XDebug>.singleton.AddLog("[SerialGameCenterLaunch] StartUpType.StartUp_WX", null, null, null, null, null, XDebugColor.XDebug_None);
								}
							}
						}
						else
						{
							if ((long)obj2 == 2L)
							{
								XSingleton<XDebug>.singleton.AddLog("[SerialGameCenterLaunch] platform == 2", null, null, null, null, null, XDebugColor.XDebug_None);
								object obj4 = null;
								if (dictionary2.TryGetValue("wakeup_qq_extInfo", out obj4))
								{
									if (obj4.ToString() == "sq_gamecenter")
									{
										@interface.OnGameCenterWakeUp(2);
										XSingleton<XDebug>.singleton.AddLog("[SerialGameCenterLaunch] StartUpType.StartUp_QQ", null, null, null, null, null, XDebugColor.XDebug_None);
									}
								}
							}
						}
					}
				}
			}
		}

		// Token: 0x060004C8 RID: 1224 RVA: 0x0001593C File Offset: 0x00013B3C
		private void SerialHandle3DTouch(string msg)
		{
			IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
			if (@interface != null)
			{
				@interface.SerialHandle3DTouch(msg);
			}
		}

		// Token: 0x060004C9 RID: 1225 RVA: 0x00015978 File Offset: 0x00013B78
		private void SerialHandleScreenLock(string msg)
		{
			IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
			if (@interface != null)
			{
				@interface.SerialHandleScreenLock(msg);
			}
		}

		// Token: 0x060004CA RID: 1226 RVA: 0x000159B4 File Offset: 0x00013BB4
		private void SerialMarketingInfo(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialMarketingInfo msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			Dictionary<string, object> dictionary = Json.Deserialize(msg) as Dictionary<string, object>;
			if (dictionary == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialMarketingInfo dict == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
				object obj;
				if (dictionary.TryGetValue("data", out obj) && @interface != null)
				{
					XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialMarketingInfo data", null, null, null, null, null, XDebugColor.XDebug_None);
					Dictionary<string, object> dictionary2 = obj as Dictionary<string, object>;
					object obj2 = null;
					if (dictionary2 != null && dictionary2.TryGetValue("flag", out obj2))
					{
						XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialMarketingInfo flag", null, null, null, null, null, XDebugColor.XDebug_None);
						if (obj2.ToString() == "Success")
						{
							object obj3 = null;
							if (dictionary2 != null && dictionary2.TryGetValue("mpinfo", out obj3))
							{
								XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialMarketingInfo mpinfo", null, null, null, null, null, XDebugColor.XDebug_None);
								List<object> list = obj3 as List<object>;
								if (list != null)
								{
									XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialMarketingInfo array != null", null, null, null, null, null, XDebugColor.XDebug_None);
									List<PayMarketingInfo> list2 = new List<PayMarketingInfo>();
									for (int i = 0; i < list.Count; i++)
									{
										object obj4 = list[i];
										Dictionary<string, object> dictionary3 = obj4 as Dictionary<string, object>;
										PayMarketingInfo payMarketingInfo = new PayMarketingInfo();
										object obj5 = null;
										if (dictionary3 != null && dictionary3.TryGetValue("num", out obj5))
										{
											XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialMarketingInfo num = " + obj5.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
											payMarketingInfo.diamondCount = int.Parse(obj5.ToString());
										}
										object obj6 = null;
										if (dictionary3 != null && dictionary3.TryGetValue("send_num", out obj6))
										{
											XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialMarketingInfo send_num = " + obj6.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
											payMarketingInfo.sendCount = int.Parse(obj6.ToString());
										}
										object obj7 = null;
										if (dictionary3 != null && dictionary3.TryGetValue("send_ext", out obj7))
										{
											XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialMarketingInfo send_ext = " + obj7.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
											payMarketingInfo.sendExt = obj7.ToString();
										}
										list2.Add(payMarketingInfo);
									}
									@interface.OnPayMarketingInfo(list2);
								}
							}
						}
					}
				}
			}
		}

		// Token: 0x060004CB RID: 1227 RVA: 0x00015C68 File Offset: 0x00013E68
		private void SerialPaySubscribeInfo(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialPaySubscribeInfo msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			Dictionary<string, object> dictionary = Json.Deserialize(msg) as Dictionary<string, object>;
			if (dictionary == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialPaySubscribeInfo dict == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
				object obj;
				if (dictionary.TryGetValue("data", out obj))
				{
					Dictionary<string, object> dictionary2 = obj as Dictionary<string, object>;
					object obj2 = null;
					if (dictionary2 != null && dictionary2.TryGetValue("flag", out obj2))
					{
						if (@interface != null)
						{
							XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialPaySubscribeInfo result =" + obj2.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
							@interface.OnPayCallback(obj2.ToString());
							return;
						}
					}
				}
				if (@interface != null)
				{
					@interface.OnPayCallback("Failure");
				}
			}
		}

		// Token: 0x060004CC RID: 1228 RVA: 0x00015D6C File Offset: 0x00013F6C
		private void SerialBuyGoodsInfo(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialBuyGoodsInfo msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			Dictionary<string, object> dictionary = Json.Deserialize(msg) as Dictionary<string, object>;
			if (dictionary == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialBuyGoodsInfo dict == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
				object obj;
				if (dictionary.TryGetValue("data", out obj))
				{
					Dictionary<string, object> dictionary2 = obj as Dictionary<string, object>;
					object obj2 = null;
					if (dictionary2 != null && dictionary2.TryGetValue("flag", out obj2))
					{
						if (@interface != null)
						{
							XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialBuyGoodsInfo result =" + obj2.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
							@interface.OnPayCallback(obj2.ToString());
							return;
						}
					}
				}
				if (@interface != null)
				{
					@interface.OnPayCallback("Failure");
				}
			}
		}

		// Token: 0x060004CD RID: 1229 RVA: 0x00015E70 File Offset: 0x00014070
		private void SerialPandoraSDKBuyGoodsInfo(string msg)
		{
			XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialPandoraSDKBuyGoodsInfo msg" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
			Dictionary<string, object> dictionary = Json.Deserialize(msg) as Dictionary<string, object>;
			if (dictionary == null)
			{
				XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialPandoraSDKBuyGoodsInfo dict == null", null, null, null, null, null, XDebugColor.XDebug_None);
			}
			else
			{
				IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
				object obj;
				if (dictionary.TryGetValue("data", out obj))
				{
					Dictionary<string, object> dictionary2 = obj as Dictionary<string, object>;
					object obj2 = null;
					if (dictionary2 != null && dictionary2.TryGetValue("flag", out obj2))
					{
						if (@interface != null)
						{
							XSingleton<XDebug>.singleton.AddLog("[PDatabase]SerialBuyGoodsInfo result =" + obj2.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
							@interface.OnPayCallback(obj2.ToString());
							return;
						}
					}
				}
				if (@interface != null)
				{
					@interface.OnPayCallback("Failure");
				}
			}
		}

		// Token: 0x060004CE RID: 1230 RVA: 0x00015F74 File Offset: 0x00014174
		private void SerialHandleReplay(string msg)
		{
			IUiUtility @interface = XSingleton<XInterfaceMgr>.singleton.GetInterface<IUiUtility>(XSingleton<XCommon>.singleton.XHash("IUiUtility"));
			if (@interface != null)
			{
				@interface.OnReplayStart();
			}
		}

		// Token: 0x040002BF RID: 703
		public PlayerInfo playerInfo;

		// Token: 0x040002C0 RID: 704
		public FriendInfo friendsInfo;

		// Token: 0x040002C1 RID: 705
		public WXGroupInfo wxGroupInfo;

		// Token: 0x040002C2 RID: 706
		public ShareCallBackType shareCallbackType = ShareCallBackType.Normal;

		// Token: 0x040002C3 RID: 707
		public WXGroupCallBackType wxGroupCallbackType = WXGroupCallBackType.Guild;
	}
}
